<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:c="http://java.sun.com/jsp/jstl/core"
                xmlns:vti="http://java.sun.com/jsf/composite/components/vti">
    <h:form id="formPesquisaUsuario" prependId="false">
        <h:panelGrid>
            <vti:inputText id="pesqNome" label="#{msgs['campo.nome']}" valid="false"
                            maxlength="40" size="51" value="#{usuarioBean.entidadePesquisa['nome']}" />
        </h:panelGrid>
        <h:panelGrid columns="2" styleClass="barraBotoes">
            <p:commandButton action="#{usuarioBean.listar}"
                             label="#{msgs['acao.pesquisar']}"
                             value="#{msgs['acao.pesquisar']}"
                             title="#{msgs['acao.pesquisar']}"
                             process="#{jsfManager.getRealName('pesqNome_text')},@this"
                             update="#{jsfManager.getRealName('tableUsuario_datatable')},#{messages}" />
            <p:commandButton actionListener="#{usuarioBean['resetPesquisa']}"
                             label="#{msgs['acao.limpar']}"
                             value="#{msgs['acao.limpar']}"
                             title="#{msgs['acao.limpar']}"
                             process="@this" update="@form,#{messages}" />
        </h:panelGrid>
        <vti:dataTable id="tableUsuario" styleClass="tableList"
                        value="#{usuarioBean.listaEntidade}"
                        selection="#{selection}" update="#{onselectUpdate}"
                        onselectComplete="#{onselectComplete}">
            <p:column sortBy="#{item.id}"
                      headerText="#{msgs['campo.id']}"
                      styleClass="columnSmallCenter">
                <h:outputText value="#{item.id}" />
            </p:column>
            <p:column sortBy="#{item.nome}"
                      headerText="#{msgs['campo.nome']}">
                <h:outputText value="#{item.nome}" />
            </p:column>
            <p:column sortBy="#{item.email}"
                      headerText="#{msgs['campo.email']}">
                <h:outputText value="#{item.email}" />
            </p:column>
            <p:column sortBy="#{item.nmSetor}"
                      headerText="#{msgs['campo.setor']}">
                <h:outputText value="#{item.nmSetor}" />
            </p:column>
            <p:column sortBy="#{item.status}"
                      headerText="#{msgs['campo.status']}">
                <h:outputText value="#{usuarioBean.getLabelStatus(item.status)}" />
            </p:column>
            <p:column styleClass="columnDelete" rendered="#{showDelete}"
                      headerText="#{msgs['acao.excluir']}">
                <p:commandLink oncomplete="dlgUsuarioDelete_widvar.show();" rendered="#{usuarioBean.jsfManager.usuarioLogado.permissoes.equals('ROLE_ADMIN')}">
                    <h:graphicImage library="images" name="del.png" width="15"
                                    alt="#{msgs['acao.excluir']}" title="#{msgs['acao.excluir']}" />
                    <f:setPropertyActionListener target="#{usuarioBean.entidade}" value="#{item}" />
                </p:commandLink>
            </p:column>
        </vti:dataTable>
    </h:form>
    <vti:dialogDelete id="dlgUsuarioDelete" actionRemover="#{usuarioBean.remover()}"
                       update="#{jsfManager.getRealName('tableUsuario_datatable')},#{messages}"/>
</ui:composition>